package com.seecen.controller;

import com.seecen.pojo.dto.ComplaintsDto;
import com.seecen.pojo.dto.MainPageDto;
import com.seecen.pojo.entity.Complaints;
import com.seecen.service.ComplaintsService;
import com.seecen.utils.Result;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @program: p2-end
 * @description:
 * @author: lxk
 * @create: 2025-10-17 14:51
 * @version: 1.0
 **/
@Slf4j
@RestController
@RequestMapping("/complaints")
@CrossOrigin
public class ComplaintsController {

    @Autowired
    private ComplaintsService complaintsService;

    @GetMapping("HotQuestions/{merchantName}")
    public Result queryHotQuestions(@PathVariable("merchantName") String merchantName){
        return complaintsService.selectHotQuestions(merchantName);
    }
    @GetMapping("HotRequires/{merchantName}")
    public Result queryHotRequires(@PathVariable("merchantName") String merchantName){
        return complaintsService.selectHotRequires(merchantName);
    }
    @PostMapping("findComplaintsPage")
    public Result findComplaintsPage(@RequestBody MainPageDto mainPageDto){
        return complaintsService.findComplaintsPage(mainPageDto);
    }
    @GetMapping("findComplaintsDetail/{cId}")
    public Result findComplaintsDetail(@PathVariable("cId") Integer cId){
        return complaintsService.findComplaintsDetail(cId);
    }

    @PostMapping("InsertComplaints")
    public Result insertComplaints(@RequestBody ComplaintsDto complaintsDto){
        return complaintsService.InsertComplaints(complaintsDto);
    }

    //红黑榜查询列表
    @PostMapping("findComplaintsPageByCompanyId")
    public Result findComplaintsPageByCompanyId(@RequestBody MainPageDto mainPageDto) {
        return complaintsService.findComplaintsPageByCompanyId(mainPageDto);
    }
}
